package com.jiyun.controller;

import com.jiyun.pojo.entity.MessagePond;
import com.jiyun.pojo.entity.User;
import com.jiyun.pojo.vo.OrderVo;
import com.jiyun.service.MessagePondService;
import com.jiyun.service.QiDanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("qidan")
public class QiDanController {
    @Autowired
    private QiDanService qiDanService;
    @Autowired
    private MessagePondService messagePondService;

    //抢单
    @RequestMapping("Qingdan")
    public User QiDan(Integer ptid,Integer oid){
        User user = qiDanService.QiDan(ptid, oid);
        return user;
    }
    //提交订单
    @RequestMapping("songda")
    public String songda(Integer oid){
        qiDanService.songda(oid);
        return "true";
    }
    //查询信息池
    @RequestMapping("findAllMessagepond")
    public List<MessagePond> findAllMessagepond(){
        return messagePondService.findAllMessagepond();
    }
    //查询跑单的对应的信息
    @RequestMapping("findPaotuiorder")
    public List<OrderVo> findPaotuiorder(Integer ptid){
        return qiDanService.findPaotuiorder(ptid);
    }

    //查询根据相应状态查询
    @RequestMapping("selectstatus")
    public List<OrderVo> selectstatus(Integer ptid,Integer seid){
        return   qiDanService.selectstatus(ptid,seid);
    }
    //确认送达
    @RequestMapping("queren")
    public void queren(Integer oid){
        qiDanService.queren(oid);
    }
}
